﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ServiceContainer.Common;

using YouWei.Utility.Logging;

namespace ServiceContainer.Commom
{
    /// <summary>
    /// 通道短信帮助类
    /// </summary>
    public class ChannelShortMsgHelper
    {
        /// <summary>
        /// 发送斑马车务生产短信
        /// </summary>
        /// <param name="mobile">手机号，多条以逗号“,”分隔</param>
        /// <param name="content">内容</param>
        /// <returns></returns>
        public static bool SendProductMsg(string mobile,string content)
        {
            bool bReturn = false;
            string userId = ConfigurationManager.AppSettings["SMSAccount"];
            string userPwd = ConfigurationManager.AppSettings["SMSPassWord"];
            int iMobiCount =1;
            var pszSubPort = "*";
            var MsgId = "1789";
            try
            {
                wmgwSoapClient client = new wmgwSoapClient();
                var szReturn = client.MongateSendSubmit(userId, userPwd, mobile, content, iMobiCount, pszSubPort, MsgId);
                if (!string.IsNullOrEmpty(szReturn))
                {
                    if (szReturn.Length <= 15)
                    {
                        bReturn = false;
                    }
                    else
                    {
                        bReturn = true;
                    }
                }
            }
            catch (Exception ex)
            {
               Log4netLog.Error("发送106通道短信时出错："+ex);
            }
            return bReturn;
        }
    }
}
